//
//  DefineMacro.h
//  UZApp
//
//  Created by 环球巨人 on 2017/1/21.
//  Copyright © 2017年 APICloud. All rights reserved.
//

#ifndef DefineMacro_h
#define DefineMacro_h

//打印        ------------------------------------------------
#ifdef DEBUG
#define WLog(...) NSLog(@"%s 第%d行 \n %@\n\n",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])
#else
#define WLog(...)
#endif

//屏幕的高宽  ------------------------------------------------
#define WSCREENH_WIDTH  [UIScreen mainScreen].bounds.size.width
#define WSCREENH_HEIGHT [UIScreen mainScreen].bounds.size.height

#define W(x) WSCREEN_WIDTH*x/320.0
#define H(y) WSCREENH_HEIGHT*y/568.0

//随机颜色    ------------------------------------------------
#define WRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]

#define WRGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define WRGBAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(r)/255.0 blue:(r)/255.0 alpha:a]

// HEX十六进制色值
#define WColorFromHexToRGB(hexValue) [UIColor colorWithRed:((float)((hexValue & 0xFF0000) >> 16))/255.0 green:((float)((hexValue & 0xFF00) >> 8))/255.0 blue:((float)(hexValue & 0xFF))/255.0 alpha:1.0]

//判断机型     ------------------------------------------------

//判断是否为iPhone
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
//判断是否为iPad
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
//判断是否为ipod
#define IS_IPOD ([[[UIDevice currentDevice] model] isEqualToString:@"iPod touch"])
// 判断是否为 iPhone 5SE
#define iPhone5SE [[UIScreen mainScreen] bounds].size.width == 320.0f && [[UIScreen mainScreen] bounds].size.height == 568.0f
// 判断是否为iPhone 6/6s
#define iPhone6_6s [[UIScreen mainScreen] bounds].size.width == 375.0f && [[UIScreen mainScreen] bounds].size.height == 667.0f
// 判断是否为iPhone 6Plus/6sPlus
#define iPhone6Plus_6sPlus [[UIScreen mainScreen] bounds].size.width == 414.0f && [[UIScreen mainScreen] bounds].size.height == 736.0f

#define XIPHONE ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone666 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

//获取系统版本
#define IOS_SYSTEM_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
//判断 iOS 8 或更高的系统版本
#define IsIOS8Later (([[[UIDevice currentDevice] systemVersion] floatValue] >=8.0)? (YES):(NO))
// 1.判断是否为ios7
#define iOS7Later ([[UIDevice currentDevice].systemVersion doubleValue] >= 7.0)

#define iOS10 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0)

//图片

//读取本地图片
#define WLOADIMAGE(file,ext) [UIImage imageWithContentsOfFile:［NSBundle mainBundle]pathForResource:file ofType:ext］

//定义UIImage对象
#define WIMAGE(A) [[UIImage imageWithContentsOfFile:［NSBundle mainBundle] pathForResource:A ofType:nil]

//首页按钮
#define Hot_Controller @"Hot_Controller"
#define Answer_Controller @"Answer_Controller"
#define Spoken_Controller @"Spoken_Controller"
#define School_Controller @"School_Controller"

//进入课程页面标示
#define Hot_Symbol @"Hot_Symbol"
#define School_Symbol @"School_Symbol"
#define School_L_Symbol @"School_L_Symbol"
#define Report_Symbol @"Report_Symbol"
#define Invoice_Symbol @"Invoice_Symbol"

#endif /* DefineMacro_h */
